/*寻找阿姆斯特朗数*/
#include <stdio.h>

int main()
{
	int n,digit[6],i,max,z,k,origin,sum,process,multi=1,min;
	scanf("%d",&n);
	max = 1;
	for (int j=1; j<=n ; j++)
	{
		max = max*10;
	}
	min = max/10;
	for ( i=min ; i<max && i>=min ; i++)
	{
		origin=i,process=i,sum=0;
		k=0;
		while ( process>0 )
		{
			digit[k] = process%10;
			process /= 10;
			k++;
		}
		for (int l=0 ; l<k ; l++)
		{
			for (int h=1 ; h<=k ; h++)
			{
				multi = multi * digit[l];
			}
			sum = sum + multi;
			multi = 1;
		}
		if ( sum == origin)
		{
			printf("%d\n",origin);
			z += 1;
		}
	}
	if ( z==0 )
	{
		printf ("No output.\n");
	}
	return 0;
 } 
